<?php
// handle posting
if(request('text') != null)
{
	$result = recaptcha_check_answer ('6Lfp7McSAAAAAFZcJah5cpmVZ9VJ4BC6MXXnmXfs', $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);	
  	if ($result->is_valid) 
  	{
		// post message
		$text = request('text');
		
		require 'uploadimage.php.inc';
		
		$id = BoardDAO::Post($text, $path, $imageURL, $thumbURL);
		$pathToPost = $path . '/' . $id;
		
		// display link to message
		?>
		<a href="?path=<?php print $pathToPost ?>" style="color: blue">Your post: <?php print $pathToPost ?></a><br />
		<?php  		
  	}
  	else
  	{
  		?>
  		<span style="color: red">The captcha was incorrect. Please try again.</span><br /> 
  		<?php
  	}  	
}